package com.youdianda.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import com.youdianda.entity.YddUser;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author mosen
 * @since 2023-05-15
 */
@Mapper
public interface YddUserMapper extends BaseMapper<YddUser> {

    @Select("select * from ydd_user where username = #{loginName}")
    YddUser getbyname (String loginName);

    /**
     * 添加用户
     * @param user
     */
    @Insert("INSERT INTO ydd_user (username, mobile, password) VALUES (#{mobile},#{mobile},#{password});")
    @Options(useGeneratedKeys = true,keyProperty ="id")
    void insertUser(YddUser user);

}
